using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;

namespace Gateway.Application.Channels;
/// <summary>
/// 
/// </summary>
public  static class ChannelApplicationBuilderExtension
{
    /// <summary>
    /// 添加通道队列
    /// </summary>
    /// <param name="services"></param>
    public static void AddChannel(this IServiceCollection services)
    {
        services.AddSingleton<RequestLogChannel>();
    }

    /// <summary>
    /// 启动通道队列
    /// </summary>
    /// <param name="app"></param>
    public static void UseChannel(this IApplicationBuilder app)
    {
        var service = app.ApplicationServices.GetService<RequestLogChannel>();
        service.Start();
    }
}